<template>
    <input type="text" v-model="address" />
    <button @click="myClick">显示太原天气</button>
    <ul v-for="(item,index) in mydata" :key="index">
        <li>{{ index }}-{{ item.day }}--{{ item.wea }}</li>
    </ul>
</template>

<script>
import axios from 'axios'
export default {
    data() {
        return {
            mydata: [],
            address:'太原'
        }
    },
    methods: {
        myClick() {
           // let ti = this
            axios.get('https://v0.yiketianqi.com/api',{
                params:{
                    unescape:1,
                    version:'v9',
                    appid:23035354,
                    appsecret:'8YvlPNrz',
                    cityid:0,
                    city:this.address,
                    ip:'0',
                    callback:0
                }
            }) 
                .then(function (response) {
                    this.mydata = response.data.data
                    console.log(response);
                }.bind(this))
                .catch(function (error) {
                    console.log(error);
                });
        }
    }
}
</script>

